//Andrew Shore		CSCE 145		Section 004		9-30-08		Lab Test 1
/*
 * This Program asks the user for a day and a time and then prints out the television show that CBS is broadcasting during this time
After the user is finished looking up programs they must type exit and a summary of the number of programs they looked up will be printed
to the screen and the program will terminate.
*/

import java.util.Scanner;

public class TVSchedule {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		
		//creates Scanner
			Scanner keyboard=new Scanner(System.in);
			
			//greets user to program and asks their name
		System.out.println("Welcome to the CBS TV Prime Time Guide");
		System.out.println("Please enter your name:");
		String name=keyboard.next();
		
		//declares 2 variables, a boolean that determines if the loop continues and a counter that keeps track of the # of programs looked up
		boolean exit=false;
		int counter=0;
		
		//while exit is not true the loop continues
		while(!exit){
			System.out.println(name+", please enter a weekend day (Exit to quit):");		//asks user to enter a weekend day
			String day=keyboard.next();
			
			//if the day is Saturday program asks user for time
			if(day.equalsIgnoreCase("Saturday")){
				System.out.println("Please enter the time");
				int time=keyboard.nextInt();
				
					//if the time is valid program is printed to screen and 1 is added to the counter, otherwise error message given
				switch(time){
				case 20:
					System.out.println("CBS will broadcast CSI: Miami at this time.");
					counter++;
					break;
				case 21:
					System.out.println("CBS will broadcast Criminal Minds at this time.");
					counter++;
					break;
				case 22:
					System.out.println("CBS will broadcast 48 Hours Mystery at this time.");
					counter++;
					break;
				default:
					System.out.println("Invalid Time! Please enter 20, 21 or 22");
	
				}
			}
			
			//if the day is Sunday program asks user for time
				if(day.equalsIgnoreCase("Sunday")){
					System.out.println("Please enter the time");
					int time2=keyboard.nextInt();
					
					//if the time is valid program is printed to screen and 1 is added to the counter, otherwise error message given
					switch(time2){
					case 20:
						System.out.println("CBS will broadcast Amazing Race at this time.");
						counter++;
						break;
					case 21:
						System.out.println("CBS will broadcast Cold Case at this time.");
						counter++;
						break;
					case 22:
						System.out.println("CBS will broadcast The Unit at this time.");
						counter++;
						break;
					default:
						System.out.println("Invalid Time! Please enter 20, 21 or 22");
					}
				}
				
				//if the weekend input does not match expected result error message is printed and user is prompted again
				if(!(day.equalsIgnoreCase("Sunday"))&& !(day.equalsIgnoreCase("Saturday"))&& !(day.equalsIgnoreCase("Exit"))){
					System.out.println("Invalid day! Input should be a weekend day ");
				}
				
				//if user types exit the program is terminated and summary is printed on the screen
					if(day.equalsIgnoreCase("Exit")){
						System.out.println(name+" successfully looked up "+counter+" television show.");
						System.out.println("Thank you for using the guide. Goodbye.");
						exit=true;
						System.exit(0);
					}
			   }
		}
	}


